package com.daotingli.backendprograms.Controller.Admin.Tag;

import com.daotingli.backendprograms.Service.Admin.Tag.TagService;
import com.daotingli.backendprograms.utils.Result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping()
public class TagController {



    @Autowired
    private TagService tagService;
    @RequestMapping(path = "/admin/tag/getAll",method = RequestMethod.POST)
    public Result getAllTags() {
        return tagService.getTag();
    }

    @PostMapping("/admin/tag/add")
    public Result addTag(@RequestParam("type") String type) {
        return tagService.addTag(type);
    }

    @PostMapping("/admin/tag/delete")
    public Result deleteTag(@RequestParam("id") Integer id) {
        return tagService.deleteTag(id);
    }

    @PostMapping("/admin/tag/update")
    public Result updateTag(@RequestParam("id") Integer id, @RequestParam("type") String type) {
        return tagService.updateTag(id, type);
    }
}
